quantity calculus